"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const degit_1 = __importDefault(require("degit"));
// 获取命令行参数
const args = process.argv.slice(2);
const [repo, branch = "main"] = args;
if (!repo) {
    console.error("Please specify a repository to clone.");
    process.exit(1);
}
const emitter = (0, degit_1.default)(`${repo}#${branch}`, {
    cache: false,
    force: true,
    verbose: true,
});
emitter.on("info", (info) => {
    console.log(info.message);
});
emitter
    .clone(`./${repo.split("/")[1]}`)
    .then(() => {
    console.log("Cloned successfully.");
})
    .catch((err) => {
    console.error(err);
    process.exit(1);
});
